package day14_io.demo04_OutputStream;

import java.io.FileInputStream;
import java.io.InputStreamReader;

public class Demo03_String {
    public static void main(String[] args) throws Exception{
        InputStreamReader isr = new InputStreamReader(new FileInputStream("E:\\csw\\Demo\\csw1\\csw3.txt"));
        char[] c = new char[1024];
        int i;
        int sum=0;
        while ((i=isr.read(c))!=-1){
//            String s = new String(c, 0, i);
//            System.out.println(s);//输出文件
            for (char c1 : c) {
                if (c1=='\n'){
                    sum++;
                }
            }
            System.out.println(sum);
        }
        isr.close();

    }
}
